package com.calvin.study.service;

import java.util.Date;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;
import org.springframework.stereotype.Service;

@Service
public class ThreadService {
	
	@Autowired
	private ThreadPoolTaskExecutor threadPoolTaskExecutor;
	
	//@Async("threadPoolTaskExecutor")
	public void testThreadPool() {
		for (int i = 0; i < 100; i++) {
			threadPoolTaskExecutor.execute(new Runnable() {
				@Override
				public void run() {
					System.out.println(Thread.currentThread().getName()+"\t"+Thread.currentThread().getId()+"\t"+new Date()+"\t"+"执行了多线程任务" );
				}
			});
		}
	}
	

}
